home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-27 | 3.9 KB | 143 lines | [TEXT/MMCC] |
- // ===========================================================================
- // • LPPobView.cp © 1995, Éric Forget. All rights reserved.
- // ===========================================================================
- //
- // ************************************************************************
- // * *
- // * Before using this code you should read the "License Agreement" *
- // * document and agree with it. *
- // * *
- // ************************************************************************
- //
- // LPPobView is a class that will load a PPob resource and put the
- // superview of this hierarchy as a subview of the LPPobView's superview.
- //
- // It is useful when you want to have a few view that are superposed as
- // in preferences panels.
- //
- // ---------------------------------------------------------------------------
- //
- // Instruction Notes:
- // -----------------
- //
- // 1) Write a PPob resource with Constructor (or whatever you want!) which is
- // a View;
- //
- // 2) In the class you want to insert the View, insert a LPPobView;
- //
- // 3) At the beginning of your application, add the call:
- //
- // URegistrar::RegisterClass(LPPobView::class_ID, LPPobView::CreatePPobViewStream);
- //
- // 4) In your application you can use the inserted view as if is was
- // created inside the Window or the dialog in the first time.
- //
- // ---------------------------------------------------------------------------
-
- #include "LPPobView.h"
-
-
-
- // ---------------------------------------------------------------------------
- // • CreatePPobViewStream [static]
- // ---------------------------------------------------------------------------
- // Return a new PPobView object initialized using data from a Stream
-
- LPPobView*
- LPPobView::CreatePPobViewStream(
- LStream *inStream)
- {
- return (new LPPobView(inStream));
- }
-
-
- // ---------------------------------------------------------------------------
- // • LPPobView()
- // ---------------------------------------------------------------------------
- // Default Constructor
-
- LPPobView::LPPobView()
- {
- InitPPobView(-1);
- }
-
-
- // ---------------------------------------------------------------------------
- // • LPPobView(const LPPobView&)
- // ---------------------------------------------------------------------------
- // Copy Constructor
- //
- // Does shallow copy; SubPanes are not copied.
-
- LPPobView::LPPobView(
- const LPPobView &inOriginal)
- : LView(inOriginal)
- {
- InitPPobView(inOriginal.mViewID);
- }
-
-
- // ---------------------------------------------------------------------------
- // • LPPobView(SPaneInfo&, SViewInfo&)
- // ---------------------------------------------------------------------------
- // Construct View from input parameters
-
- LPPobView::LPPobView(
- const SPaneInfo &inPaneInfo,
- const SViewInfo &inViewInfo,
- const ResIDT inViewID)
- : LView(inPaneInfo, inViewInfo)
- {
- InitPPobView(inViewID);
- }
-
-
- // ---------------------------------------------------------------------------
- // • LPPobView(LStream*)
- // ---------------------------------------------------------------------------
- // Construct View from data in a Stream
-
- LPPobView::LPPobView(
- LStream *inStream)
- : LView(inStream)
- {
- ResIDT viewID;
-
-
- inStream->ReadData(&viewID, sizeof(ResIDT));
-
- InitPPobView(viewID);
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~LPPobView
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- LPPobView::~LPPobView()
- {
-
- }
-
-
- // ---------------------------------------------------------------------------
- // • InitPPobView
- // ---------------------------------------------------------------------------
-
- void
- LPPobView::InitPPobView(
- const ResIDT inViewID)
- {
- mViewID = inViewID;
-
- if(mViewID != -1) {
-
- SetDefaultView(mSuperView);
- LView *theView = (LView *) UReanimator::ReadObjects('PPob', mViewID);
- }
- }
-
-
-